use thiserror::Error;

pub(crate) type CompilerResult<T> = Result<T, CompilerError>;

#[derive(Error, Debug)]
pub(crate) enum CompilerError {
    #[error("invalid file, must be a .jack file : {0}")]
    FileExt(String),
    #[error("not a operator : {0}")]
    Operator(String),
    #[error("not a term : {0}")]
    Term(String),
    #[error("not a int constant : {0}")]
    IntConst(String),
    #[error("not a string constant : {0}")]
    StringConst(String),
    #[error("not a indentifier : {0}")]
    Indentifier(String),
    #[error("not a keyword : {0}")]
    Keyword(String),
    #[error("not a subroutine call : {0}")]
    SubroutineCall(String),
    #[error("not a statement : {0}")]
    Statement(String),
    #[error("symbol err: {0}")]
    Symbol(String),
    #[error("program struct err: {0}")]
    Program(String),
}
